import {
  FormItemProps,
  InputProps,
  InputNumberProps,
  SegmentedProps,
  ColorPickerProps
} from 'element-plus'
import { IconSelectorPropsType } from '../XIconSelector'
import { IptTypeConst } from './consts'

export const IptTypeConstType_Name = 'IptTypeConstType'
export const IptPropsType_Name = 'IptPropsType'

export type IptTypeConstType = (typeof IptTypeConst)[keyof typeof IptTypeConst]

export type IptPropsType = {
  // 输入组件类型
  iptType?: IptTypeConstType
  // 输入组件 Props
  iptProps?:
    | Partial<Omit<InputProps, 'value' | 'onUpdate:value' | 'modelValue' | 'onUpdate:modelValue'>>
    | Partial<
        Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'modelValue' | 'onUpdate:modelValue'>
      >
    | Partial<
        Omit<SegmentedProps, 'value' | 'onUpdate:value' | 'modelValue' | 'onUpdate:modelValue'>
      >
    | Partial<
        Omit<ColorPickerProps, 'value' | 'onUpdate:value' | 'modelValue' | 'onUpdate:modelValue'>
      >
    | Partial<
        Omit<
          IconSelectorPropsType,
          'value' | 'onUpdate:value' | 'modelValue' | 'onUpdate:modelValue'
        >
      >
    | Record<string, any>
  // 输入框值
  value?: any
  // 输入框值变化时触发的回调函数
  'onUpdate:value'?: (value?: any) => void
  // 是否使用表单项组件
  formItem?: boolean
  // 表单项组件 Props
  formItemProps?: Partial<FormItemProps>
}
